﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MacViet.DataBaseAPI;
public partial class AdminLogin : System.Web.UI.Page
{
    ACCOUNTSDataAPI acc_api = new ACCOUNTSDataAPI();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack) return;
        lblMessage.Visible = false;
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string password = txtPassword.Text.Trim();
        string email = txtEmail.Text.Trim();
        if (acc_api.AddminLogin(email, password))
        {
            Session["admin"] = email;
            Response.Redirect("Registry.aspx");
        }
        else
        {
            lblMessage.Visible = true;
            lblMessage.Text = "The Email or Password is incorrect!";
        }
    }
    protected void chkMark_CheckedChanged(object sender, EventArgs e)
    {
        string pass = txtPassword.Text;
        if (chkMark.Checked == true)
        {
            txtPassword.TextMode = TextBoxMode.SingleLine;
            txtPassword.Text = pass;
        }
        else
        {
            txtPassword.TextMode = TextBoxMode.Password;
            txtPassword.Text = pass;
        }
    }
}
